import { getWeather30Html } from "@/services/weather";
import { defineStore } from "pinia";

const useWeather30Store = defineStore("weather30", {
  state: () => ({
    word: "",
    day30: [],
    clickItem: {},
  }),
  actions: {
    async fetchWeather30Data(city, code) {
      const res = await getWeather30Html(city, code);
      this.word = res.word;
      this.day30 = res.day30;
      this.clickItem = this.day30[0];
    },
    async fetchItemClick(item) {
      this.clickItem = item;
    },
  },
});

export default useWeather30Store;
